import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jc.constant.PolicyAttachmentTypeConst;
import com.jc.util.HttpPostUtil;
import com.jc.util.R;
import com.jc.vo.ApiConfig;
import com.jc.vo.PolicyAttachment;
import com.jc.vo.PolicyVO;
import com.jc.vo.QuotaApplyVO;
import org.junit.Test;

import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class CrossOrderQueryDemo {

    // jc提供的SecretId
    public static String SECRET_ID = "100002";
    // jc提供的SecretKey
    public static String SECRET_KEY = "2a4afaf10a0ebd926dc91387373a0594";


    public static String SERVICE_HOST = "127.0.0.1:8080";

    public static String INSURE_SERVICE_URL = "http://" + SERVICE_HOST + "/jc-order/cross/v1/queryPolicy";


    @Test
    public void testQueryPolicy() throws ParseException {

        ApiConfig config = new ApiConfig(SECRET_ID, SECRET_KEY, INSURE_SERVICE_URL);
        try {
            String s="{\"snNos\":\"C20250822170435001\"}";

            ObjectMapper om = new ObjectMapper();
            om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
            om.setSerializationInclusion(JsonInclude.Include.NON_NULL);
            String response = HttpPostUtil.send(s, config, false);
            R r = om.readValue(response, R.class);
            try {
//                if (r.getSuccess()) {
//                    PolicyVO result = om.convertValue(r.getContent(), PolicyVO.class);
//                    r.setContent(result);
//                }
            } catch (Exception e) {
                r.setSuccess(false);
                r.setCode(R.RCODE.SYS_ERROR.getCode());
                r.setMessage(R.RCODE.SYS_ERROR.getMessage());
                e.printStackTrace();
            }
            System.out.println(r.getMessage());
            System.out.println(response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }














}
